package com.cari.oa.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;

public class FileDemo {
	
	public static void main(String[] args) {
		File file = new File("d:/1.txt");
		try {
//			FileInputStream fis = new FileInputStream(file);
//			byte[] by = new byte[1024];
//			StringBuilder sb = new StringBuilder();
//			while(fis.read(by)!=-1){
//				sb.append(new String(by,"utf-8"));
//				by = new byte[1024];
//			}
//			fis.close();
//			System.out.println(sb.toString());
	        BufferedReader br=new BufferedReader(new FileReader(file));
	        String temp=null;
	        StringBuffer sb=new StringBuffer();
	        temp=br.readLine();
	        while(temp!=null) {
	            sb.append(temp+"\n");
	            temp=br.readLine();
	        }
	        br.close();
	        System.out.println(sb.toString());

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
